package com.twu.model;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * User: FSW
 * Date: 24/05/13
 * Time: 下午 05:54
 * To change this template use File | Settings | File Templates.
 */
public class Customer {
    private String name;
    private String password;
    private String email;
    private String id = "";
    private long hp;

    public Customer(String name, String password, String email, long hp) {
        this.name = name;
        this.password = password;
        this.email = email;
        this.hp = hp;
    }

    public Customer(String name, String password, String email, String id, long hp) {
        this.name = name;
        this.password = password;
        this.email = email;
        this.id = id;
        this.hp = hp;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getId() {
        return id;
    }

    public void setId(Library library) {
        //library id format xxx-xxxx, starting from 111-1111
        int prefix = 111;
        int ending = 1111;
        ending = ending + library.getNoOfCustomers();
        if(ending > 9999){
            prefix = ending/10000 + prefix;
            ending = ending%10000;
        }
        this.id = prefix +"-"+ending;;
    }

    public long getHp() {
        return hp;
    }

    public void setHp(long hp) {
        this.hp = hp;
    }

    public void printProfile(){
        System.out.println("Username: "+name);
        System.out.println("Email: "+email);
        System.out.println("Handphone: "+hp);
    }
}
